import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:tearch_plugin/tearch_plugin.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
//      platformVersion = await TearchPlugin.toAliPay(
//          "https://openapi.alipaydev.com//gateway.do?charset=utf-8&method=alipay.trade.wap.pay&sign=GWvTv27tAVuLdIRhs49U7%2B%2F6Zui3hK9ATLy6JDUJrIDYkoBIeO6RVlWxmXSuFARrSuf7b8m5RBWw1knIyeg7XERVUUONQj2BjPUT1Ye0AOhJ5R9MB%2B13UbPDa1qCPqaX6FjmxYXGE78DAnfQRyltUzQM20lv9PBtZeu4MMqvy09bgNdQYikeDAFWPTXqaXvsGtlilZyGdnu2rZG6WKAGI8oR3XedBt%2Fa0vXvW042tzN6T6UglN1uva3%2Bz1l28eYTaGjAHSHQDBSBz9s6ZAFmmNqJl%2FhAQ0%2BQK3yXa%2Ft5E0FroUASpxoJO%2Ba0JnRykLlUPa63zTuyAZkkNhq%2F1YcwUg%3D%3D&return_url=http%3A%2F%2Fxxx.com%2Freturn&notify_url=http%3A%2F%2Fxxx.com%2Fnotify&app_id=2016102300747099&sign_type=RSA2&version=1.0&timestamp=2020-08-27+18%3A05%3A05");
    } on PlatformException {
      https: //mapi.alipay.com/gateway.do?_input_ch
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: GestureDetector(
              onTap: () async {

              },
              child: Text('Running on:')),
        ),
      ),
    );
  }
}
